package com.catmiao.spark.framework.util

import org.apache.spark.SparkContext

/**
 * @title: EnvUtil
 * @projectName spark_study
 * @description: TODO
 * @author ChengMiao
 * @date 2024/3/15 16:27
 */
object EnvUtil {

  private val scLocal = new ThreadLocal[SparkContext]

  def put(sc :SparkContext): Unit = {
    scLocal.set(sc)
  }

  def take(): SparkContext = {
    scLocal.get
  }

  def clear(): Unit = {
    scLocal.remove
  }

}
